package com.kgcx.system.controller;

import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.system.domain.AppGuide;
import com.kgcx.system.service.AppGuideService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 吴刚林
 * @date 2017/11/29
 */
@Api(description = "引导页", tags = "引导页接口")
@RestController
@RequestMapping("appguide")
public class AppGuideController extends BaseController {

    @Autowired
    private AppGuideService appGuideService;

    @ApiOperation(value = "新增引导页", httpMethod = "POST", notes = "这是用来新增引导页的接口")
    @PostMapping("addAppGuide")
    public ReturnData addAppGuide(@RequestBody AppGuide appGuide) {
        appGuideService.addAppGuide(appGuide);
        return new ReturnData<>();
    }

    @ApiOperation(value = "查询引导页", httpMethod = "GET", notes = "这是用来查询引导页的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "version", value = "版本号", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("getAppGuide")
    public ReturnData<AppGuide> getAppGuide(@RequestParam String version) {
        return new ReturnData<>(appGuideService.getAppGuide(version));
    }
}
